package com.shinechain.command;
import org.telegram.telegrambots.api.methods.send.SendMessage;
import org.telegram.telegrambots.api.objects.Chat;
import org.telegram.telegrambots.api.objects.User;
import org.telegram.telegrambots.bots.AbsSender;
import org.telegram.telegrambots.bots.commandbot.commands.BotCommand;
import org.telegram.telegrambots.exceptions.TelegramApiException;
import org.telegram.telegrambots.logging.BotLogger;

public class KeyCommand extends BotCommand {
    public KeyCommand() {
        super("key", "输入口令拿红包");
    }

    @Override
    public void execute(AbsSender absSender, User user, Chat chat, String[] strings) {
        System.out.println(user.getUserName());
        System.out.println(strings.toString());
        System.out.println(chat.getId());
        SendMessage sendMessage = new SendMessage();
        sendMessage.setChatId(chat.getId());
        sendMessage.setText("恭喜你拿到个屁红包");

        try{
            absSender.execute(sendMessage);
        }catch (TelegramApiException e){
            BotLogger.error("GetRed",e);
        }

    }
}
